package com.ts.api.module.api.convert.receive.handler;

import com.gitee.apanlh.web.model.vo.RequestVO;
import com.ts.api.module.api.convert.receive.entity.ApiReceiveApply;
import com.ts.api.module.api.convert.receive.entity.ApiReceiveDecrypt;
import com.ts.api.module.api.convert.receive.entity.ApiReceiveNotice;
import com.ts.api.module.api.convert.receive.entity.ApiReceivePhoneMaskDataExchange;
import com.ts.api.module.api.entity.ApiUserRequest;

import java.util.Map;

/**
 *  API渠道-接入处理器-手机号掩码
 *
 */
public interface ApiReceivePhoneMaskConvertHandler {

    /**
     *  验证参数并且返回解密参数
     *
     *  @param  requestVO
     *  @return Map
     */
    Map<String, String> requireParam(RequestVO requestVO) throws Exception;

    /**
     *  接收数据解密方法
     *
     *  @param  paramMap    参数map
     *  @param  requestVO   请求VO实体
     *  @return ApiReceiveDecryptMessage
     */
    ApiReceiveDecrypt decrypt(Map<String, String> paramMap, RequestVO requestVO) throws Exception;

    /**
     *  解析撞库请求
     *
     *  @param  apiReceiveDecrypt
     *  @return ApiUserInfo
     */
    ApiUserRequest parseDataExchange(ApiReceiveDecrypt apiReceiveDecrypt) throws Exception;

    /**
     *  撞库返回实体类
     *
     *  @param  apiReceivePhoneMaskDataExchange  撞库消息类
     *  @return ApiRespReceiveDataExchange
     */
    Map<String, Object> respDataExchange(ApiReceivePhoneMaskDataExchange apiReceivePhoneMaskDataExchange) throws Exception;

    /**
     *  解析进件请求
     *
     *  @param  apiReceiveDecrypt
     *  @return ApiUserInfo
     */
    ApiUserRequest parseApply(ApiReceiveDecrypt apiReceiveDecrypt) throws Exception;

    /**
     * 进件返回实体
     *
     * @param apiReceiveApply 进件消息类
     * @return ApiRespReceiveDataExchange
     */
    Map<String, Object> respApply(ApiReceiveApply apiReceiveApply) throws Exception;

    /**
     *  撞库-进件实现字段转换映射
     *
     *  @param apiUserRequest  拷贝后的ApiUserINfo
     */
    void fieldMapping(ApiUserRequest apiUserRequest);

    /**
     *  请求对方-我方接入-拉取进件通知（封装对方需要的参数请求）
     *
     *  @param  apiReceiveNotice 回调请求消息实体类
     *  @return Map
     */
    Object reqPullApplyNotice(ApiReceiveNotice apiReceiveNotice);

    /**
     *  响应业务判断-我方接入-拉取进件通知
     *
     *  @param  responseBody 原始响应请求
     *  @return Map
     */
    boolean respPullApplyNotice(String responseBody);

    /**
     *  我方接入-推送进件成功通知
     *
     *  @param  apiReceiveNotice 回调请求消息实体类
     *  @return Map
     */
    Object reqPushApplyNotice(ApiReceiveNotice apiReceiveNotice);

    /**
     *  我方接入-推送进件成功通知
     *
     *  @param  responseBody 原始响应请求
     *  @return Map
     */
    boolean respPushApplyNotice(String responseBody);
}
